from rest_framework  import serializers

from apps.goods.models import GoodsVisitCount


class UserCategoryCountSerializer(serializers.ModelSerializer):
    # 因为响应数据需要显示商品名称，所以需要关联商品表名称
    category = serializers.StringRelatedField(read_only=True)

    class Meta:
        model = GoodsVisitCount
        fields = ['count', 'category']